import QtQuick 2.0
import NumberProcess 1.0

Item {
    property int num: 0
    id: root
    anchors.fill: parent
    Text {
        id: label
        anchors.top: parent.top
        anchors.topMargin: 300
        anchors.horizontalCenter: parent.horizontalCenter
        font {
            pixelSize: 25
            family: "Microsoft YaHei"
        }
        color: "#f8b62c"
        text: "自动变化数字："
    }
    Text {
        id: showNum
        anchors.top: label.bottom
        anchors.horizontalCenter: parent.horizontalCenter
        font {
            pixelSize: 200
            family: "Microsoft YaHei"
        }
        color: numberHandler.num % 100 ? color : Qt.rgba(Math.random(), Math.random(), Math.random(), 1)
        text: numberHandler.num
    }
    // 实例化对象
    NumberHandler {
        id: numberHandler
    }
    // 数字变化信号槽连接
//    Connections {
//        target: numberHandler
//        onNumberChanged: {
//            num = number
//        }
//    }
    Component.onCompleted: numberHandler.startTimer(1000)
}
